package com.xmut.mall.cart.controller;

import com.xmut.mall.cart.feign.CacheFeignService;
import com.xmut.mall.cart.utils.RespBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class TestController {
    @Autowired
    private CacheFeignService cacheFeignService;

    @Autowired
    private HttpServletRequest request;

    @GetMapping("/testCacheFeign")
    public RespBean testCacheFeign() {
        return cacheFeignService.testFeign();
    }

    @GetMapping("/testFeign")
    public RespBean testFeign() {
        return RespBean.success("测试成功");
    }

    @GetMapping("/testUserAgent")
    public RespBean testUserAgent() {
        return RespBean.success("11", request.getHeader("User-Agent"));
    }
}
